package co.sanduche.teach.old;

import java.util.List;

import org.apache.http.cookie.Cookie;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.util.Log;
import android.view.View;

import co.sanduche.teach.R;
import co.sanduche.teach.R.layout;

import com.loopj.android.http.PersistentCookieStore;

public class CopyOfSplashScreenActivity extends Activity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_splash_screen);
		new Handler().postDelayed(new Runnable() {

			/*
			 * Showing splash screen with a timer. This will be useful when you
			 * want to show case your app logo / company
			 */

			@Override
			public void run() {
				goNext(null);
			}
		}, SPLASH_TIME_OUT);

	}

	public void goNext(View view) {
		Log.v(getClass().getSimpleName(), "goNext");
		PersistentCookieStore cookieStore = null;// TeachApp.getCookieStore();
		List<Cookie> cookies = cookieStore.getCookies();
		// System.out.println(cookies);
		for (Cookie c : cookies)
			if (c.getName().equals("PLAY_SESSION")) {
				Log.i("play cookie", c.toString());
				// This method will be executed once the timer is over
				// Start your app main activity
				Intent i = new Intent(CopyOfSplashScreenActivity.this,
						MainActivity.class);
				startActivity(i);

				// close this activity
				finish();
				return;
			}

		Intent i = new Intent(CopyOfSplashScreenActivity.this,
				StudentListActivity.class);
		startActivity(i);
		finish();
	}

	// Splash screen timer
	private static int SPLASH_TIME_OUT = 20000;

}
